package pl.moominek.ekosegragator;

import java.util.ArrayList;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class ListaPszokowAdapter extends BaseAdapter {

    private ArrayList<ListaPszokowZawartosc> data;
    private Context ctx;
 
    public ListaPszokowAdapter(Context ctx, ArrayList<ListaPszokowZawartosc> importeddata) {
    	this.ctx = ctx;
    	this.data = importeddata;
    }
 
    public int getCount() {
    return data.size();
    }
	 
	public Object getItem(int position) {
	    return null;
	}
	 
	public long getItemId(int position) {
	    return 0;
	}
	 
	public View getView(int position, View convertView, ViewGroup parent) {	 
		
		 if (convertView == null) {
			 LayoutInflater inflater = (LayoutInflater) ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
			 convertView = inflater.inflate(R.layout.lista_pszokow_zawartosc, parent, false);
		 }
		 
		    TextView miasto = (TextView) convertView.findViewById(R.id.textView_miasto);
		    TextView kod = (TextView) convertView.findViewById(R.id.textView_kodPocztowy);
		    TextView ulica = (TextView) convertView.findViewById(R.id.textView_ulica);
		    TextView numer = (TextView) convertView.findViewById(R.id.textView_numerMieszkania);
		    TextView dodatkowe = (TextView) convertView.findViewById(R.id.textView_dodatkowe);
		    
		   
		    miasto.setText(data.get(position).get_miasto());
		    kod.setText(data.get(position).get_kod());
		    ulica.setText(data.get(position).get_ulica());
		    numer.setText(""+ data.get(position).get_numer());
		    dodatkowe.setText(data.get(position).get_dodatkowe());

	    return convertView;
	}
}
